<template>
  <div id="vmMonitor" class="div-vm-monitor">
    <iframe id="monitor-iframe-id" :src="monitorSrcUrl" width="100%"
            style="border-width: 0px; overflow-y: hidden; scrolling: no;min-height: 97vh "></iframe>
  </div>
</template>

<script>
import local from './local'
import $ from 'jQuery'

export default {
  name: 'VmMonitor',
  props: ['vmId', 'platformResourceId'],
  i18n: {
    messages: local
  },
  data() {
    return {
      pageHeight: 500,
      monitorSrcUrl: '',
      ocAdress: ''
    }
  },
  mounted() {
    this.pageHeight = window.innerHeight - 150
    window.onresize = () => {
      return (() => {
        this.pageHeight = window.innerHeight - 150
      })()
    }
    this.getOcAdress()
  },
  beforeDestroy() {
  },
  methods: {
    getOcAdress() {
      var iframe = document.getElementById('monitor-iframe-id')
      // 注明 课题三的通过vpn连接的那个环境，当打包的时候需要将地址换成下面的
      //vpn连接的那个环境 iframe.src = 'http://192.168.124.8/app/platformInfo'
      iframe.src = 'http://106.53.27.235:21350/app/platformInfo'
    },
  },
  computed: {
    tip() {
      return '如果使用chrome浏览器发生跨域问题，请按以下方式进行配置：<br/>\
        chrome浏览器中搜索下面地址：<br/>\
        chrome://flags/#same-site-by-default-cookies <br/>\
        chrome://flags/#cookies-without-same-site-must-be-secure <br/>\
        这两项设置为Disabled，并重启浏览器'
    }
  }
}
</script>

<style lang="scss" scoped>
.div-vm-monitor {
  width: 100%;
}
</style>
